package likou;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2020/12/09 06:40
 */
public class _62 {
    public static void main(String[] args) {
        System.out.println(uniquePaths(3, 7));
    }

    public static int uniquePaths(int m, int n) {
        int daan[][] = new int[m][n];
        if (m == 0 && n == 0) {
            return 0;
        }
        if (m == 0 || n == 0) {
            return 1;
        }
        daan[0][0] = 1;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                daan[i][j] = (i > 0 ? daan[i - 1][j] : 0) + (j > 0 ? daan[i][j - 1] : 0) + daan[i][j];
            }
        }
        return daan[m - 1][n - 1];
    }
}
